<!DOCTYPE html>
<html>
<head>
    <th:block th:include="include :: headermain('互助保障系统V3')"/>
    <title>业务办理-入会业务-参互情况</title>
    <script src="/plugin/jquery/jquery.min.js"></script>
    <script src="/plugin/jquery/jquery.plugin.js"></script>
    <script src="/plugin/vue/vue.min.js"></script>
    <script src="/plugin/layui/layui.all.js"></script>
    <script src="/unit/resource/js/script.js"></script>
</head>
<body>
<div class="page">
    <!-- 头部信息 -->
    <th:block th:include="include :: top"/>
    <div class="center">
        <div class="page-content page-wrap">
            <!-- 左侧导航 -->
            <th:block th:include="include :: left"/>

            <div class="page-wrap-container">
                <div class="page-account">
                    <div class="page-tab">
                        <a class="on" href="/hzpolicy/hzPolicyFront/policySituation">参互情况</a>
                        <a href="/hzpolicy/hzPolicyFront/policyApply">业务办理</a>
                        <a href="/hzpolicy/hzPolicyFront/policyPerson">职工入会</a>
                    </div>
                    <div class="page-tab-content" style="display:block;padding-top:30px;">
                        <h3 style="margin:10px 0">入会情况</h3>
                        <table class="page-table page-table-list" style="margin-bottom:40px">
                            <tr>
                                <th>活动名称</th>
                                <th>参加人数</th>
                                <th style="width:90px;">过期时间</th>
                                <th>当前状态</th>
                                <th style="width:175px;"></th>
                            </tr>
                            <c:if test="${empty hzPolicyInfos}">
                                <tr><td colspan="5" style="padding:20px;">暂无入会信息</td></tr>
                            </c:if>
                            <c:if test="${not empty hzPolicyInfos}">
                                <c:forEach items="${hzPolicyInfos}" var="hzPolicyInfo">
                                    <tr>
                                        <td>${hzPolicyInfo.insuranceName}</td>
                                        <td>
                                            <c:if test="${empty hzPolicyInfo.totalperson}">/</c:if>
                                            <c:if test="${not empty hzPolicyInfo.totalperson}">${hzPolicyInfo.totalperson}人</c:if>
                                        </td>
                                        <td>
                                            <c:if test="${empty hzPolicyInfo.endTime}">/</c:if>
                                            <c:if test="${not empty hzPolicyInfo.endTime}">${hzPolicyInfo.endTime}</c:if>
                                        </td>
                                        <td>
                                            <c:if test="${hzPolicyInfo.complete == 1}">
                                                <span style="color:green">正常在保</span>
                                            </c:if>
                                            <c:if test="${hzPolicyInfo.complete == 0}">
                                                <span style="color:green">正在办理</span>
                                            </c:if>
                                        </td>
                                        <td>
                                            <a class="layui-btn layui-btn-sm layui-btn-primary btn-info" data-id="${hzPolicyInfo.insuranceId}">活动简介</a>
                                            <a class="layui-btn layui-btn-sm btn-history" data-id="${hzPolicyInfo.insuranceId}">入会记录</a>
                                        </td>
                                    </tr>
                                </c:forEach>
                            </c:if>
                        </table>
                        <h3 style="margin:10px 0">待续互列表</h3>
                        <table class="page-table page-table-list" style="margin-bottom:40px">
                            <tr>
                                <th>活动名称</th>
                                <th>标准人数</th>
                                <th style="width:280px;">过期时间</th>
                                <th></th>
                            </tr>
                            <c:if test="${empty renewalPolicys}">
                                <tr>
                                    <td colspan="5" style="padding:20px;">暂无待续保活动</td>
                                </tr>
                            </c:if>
                            <c:if test="${not empty renewalPolicys}">
                                <c:forEach items="${renewalPolicys}" var="renewalPolicy">
                                    <tr>
                                        <td>${renewalPolicy.insurancename}</td>
                                        <td>
                                            ${renewalPolicy.totalperson}人
                                        </td>
                                        <td>
                                            <span style="color:red">${renewalPolicy.endDate}</span>
                                        </td>
                                        <td>
                                            2020年度入会已结束，新一年度的入会电话详询：04715222966
                                            <%-- <a class="layui-btn apply-btn-renewal" data-id="${renewalPolicy.id}">续互</a> --%>
                                        </td>
                                    </tr>
                                </c:forEach>
                            </c:if>
                        </table>
                        <h3 style="margin:10px 0">所属机构</h3>
                        <table class="page-table">
                            <tr>
                                <th>机构名称</th>
                                <td>${officeInfo.name}</td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- 底部信息 -->
    <th:block th:include="include :: footer"/>
</div>

<script type="text/javascript">

    /* 活动简介 */
    $(".btn-info").click(function () {
        $.soon.ajax({
            url: "/hzpolicy/hzPolicyFront/getInsuranceById?insuranceId=" + $(this).attr("data-id"),
            success: function (data) {
                $.soon.open({
                    width: "1000px",
                    height: "90%",
                    title: "保障活动简介",
                    content: '<div style="padding:20px;">' + data.content + '</div>'
                });
            }
        });

    });

    /* 入会记录 */
    $(".btn-history").click(function () {
        $.soon.open({
            url: "/hzpolicy/hzPolicyFront/getPolicyRecordByUtilId?insuranceId=" + $(this).attr("data-id"),
            width: "800px",
            height: "80%",
            title: '历史入会记录',
        });

    });

    /* 续互 */
    $(".apply-btn-renewal").click(function () {
        var renewalId = $(this).attr("data-id");
        layer.confirm('确实要发起续互申请吗？', {
            btn: ['发起', '取消']
        }, function () {
            $.soon.ajax({
                url: "/hzpolicy/hzPolicyFront/renewalPolicyApply?id=" + renewalId,
                method : 'Post',
                dataType: "json",
                success: function (data) {
                    if(data.success){
                        layer.msg("处理成功");
                        setTimeout(function () {
                            window.location.href = "/hzpolicy/hzPolicyFront/launchPolicyApply?id=" + data.body.policy.id;
                        }, 1000);
                    }else{
                        layer.msg(data.msg);
                    }
                }
            });
        });
    });

</script>

</body>
</html>
